<%@ Page Language="C#" MasterPageFile="~/cms.master" AutoEventWireup="true" CodeFile="ProductEdit.aspx.cs"
    Inherits="ProductEdit" Title="<%$Resources:Language,CmsProductEditTitle %>" ValidateRequest="false"
    EnableEventValidation="false" %>

<%@ Register Assembly="Winthusiasm.HtmlEditor" Namespace="Winthusiasm.HtmlEditor"
    TagPrefix="cc2" %>
<%@ Register Src="../controls/ctrlShowInfo.ascx" TagName="ctrlShowInfo" TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/controls/ctrlProductChoose.ascx" TagName="ctrlProductChoose"
    TagPrefix="ctrl" %>
<%@ Register Src="~/controls/ctrlSearchProduct.ascx" TagName="ctrlSearchProduct"
    TagPrefix="ctrl" %>
<%@ Register Src="~/controls/ctrlWait.ascx" TagName="ctrlWait" TagPrefix="ctrl" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="Server">

    <script language="javascript" type="text/javascript" src="../Javascript/ProductEdit.js"></script>

    <script language="javascript" type="text/javascript" src="../Javascript/Common.js"></script>

    <ctrl:ctrlWait ID="ctrlWait" runat="server" />
    <asp:UpdatePanel ID="upProductEdit" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
        <ContentTemplate>
            <div id="dProductEdit">
                <h2>
                    <%=Resources.Language.ProductEdit %>
                    <%= ProductID > 0 ? "ID"+ ProductID.ToString() : "" %></h2>
                <asp:HiddenField ID="hfEditMode" Value="false" runat="server" />
                <uc1:ctrlShowInfo ID="CtrlShowInfo" runat="server" />
                <div class="Controls">
                    <span class="peBoxLeft"></span><span class="peBoxRight">
                        <asp:Button ID="btnSaveChangesTop" runat="server" Text="<%$Resources:Language,SaveChanges %>"
                            OnClick="btnSaveProduct_Click" />
                        <asp:Button ID="btnNewProductTop" runat="server" Text="<%$Resources:Language,CreateNew %>"
                            OnClick="btnNewProduct_Click" CausesValidation="false" />
                        <asp:Button ID="btnCancelChangesTop" runat="server" Text="<%$Resources:Language,Cancel %>"
                            OnClick="btnCancelChanges_Click" CausesValidation="false" />
                        <asp:Button ID="btnDeleteProductTop" runat="server" Text="<%$Resources:Language,DeleteProduct %>"
                            OnClick="btnDeleteProduct_Click" CausesValidation="false" />
                    </span>
                </div>
                <div class="vSeparate">
                    <ctrl:ctrlSearchProduct ID="ctrlSearchProduct" runat="server" OnProductSearch="ctrlSearchProduct_ProductSearch"
                        OnClearSearchCriteria="ctrlSearchProduct_ClearSearchCriteria" />
                </div>
                <div class="vSeparate">
                    <asp:UpdatePanel ID="upProductChoose" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <ctrl:ctrlProductChoose ID="ctrlProductChoose" NewProduct="true" runat="server" OnProductListIndexChanged="ProductChoosed"
                                AutoPostBack="true" ShowBundle="true" />
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ctrlSearchProduct" />
                            <asp:AsyncPostBackTrigger ControlID="btnNewProductTop" />
                            <asp:AsyncPostBackTrigger ControlID="btnNewProductBottom" />
                            <asp:AsyncPostBackTrigger ControlID="btnSaveChangesTop" />
                            <asp:AsyncPostBackTrigger ControlID="btnSaveChangesBottom" />
                            <asp:AsyncPostBackTrigger ControlID="btnDeleteProductTop" />
                            <asp:AsyncPostBackTrigger ControlID="btnDeleteProductBottom" />
                        </Triggers>
                    </asp:UpdatePanel>
                </div>
                <div id="editPanel" runat="server">
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%= Resources.Language.Lang %>: </span><span class="peBoxRight">
                                <asp:DropDownList ID="ddlLanguages" runat="server" DataTextField="Name" DataValueField="LanguageID"
                                    AutoPostBack="True" OnSelectedIndexChanged="ddlLanguages_SelectedIndexChanged"
                                    CssClass="DropDownShort">
                                </asp:DropDownList>
                            </span>
                    </div>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%=Resources.Language.Name %>: </span><span class="peBoxRight">
                                <asp:TextBox ID="tbName" runat="server" CssClass="TextInputWide"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvName" runat="server" ControlToValidate="tbName"
                                    ErrorMessage="*" EnableClientScript="false"></asp:RequiredFieldValidator>
                            </span>
                    </div>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%= Resources.Language.ProductMetaTags %>: </span><span class="peBoxRight">
                                <asp:TextBox ID="tbProductMetaTags" runat="server" CssClass="TextInputWide"></asp:TextBox>
                            </span>
                    </div>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                        <ContentTemplate>
                            <div class="vSeparate">
                                <span class="peBoxLeft">
                                    <asp:Label ID="lPrice" runat="server" Text="<%$ Resources:Language,PriceBrutto %>"></asp:Label>:
                                </span><span class="peBoxRight"><span class="peInnerBoxRight">
                                    <asp:TextBox ID="tbPrice" CssClass="TextInputShort" runat="server" OnTextChanged="PriceKindChange"
                                        AutoPostBack="true"></asp:TextBox>
                                    <asp:CompareValidator ID="cvPrice" runat="server" ControlToValidate="tbPrice" Type="Double"
                                        Operator="GreaterThanEqual" ValueToCompare="0" ErrorMessage="*" EnableClientScript="false"
                                        Display="Dynamic">
                                    </asp:CompareValidator>
                                    <asp:RequiredFieldValidator ID="rfvPrice" runat="server" ControlToValidate="tbPrice"
                                        ErrorMessage="*" EnableClientScript="false" Display="Dynamic"></asp:RequiredFieldValidator>
                                </span><span class="peInnerBoxLeft">
                                    <asp:Label ID="lPriceKind" runat="server" Text="<%$Resources:Language,PriceNetto %>"></asp:Label>:</span><span
                                        class="peInnerBoxRight"><asp:TextBox ID="tbPrice2" runat="server" Enabled="false"
                                            CssClass="TextInputShort"></asp:TextBox></span><span class="peInnerBoxLeft">
                                                <%=Resources.Language.PriceKind %>: </span><span class="peInnerBoxRight">
                                                    <asp:DropDownList ID="ddlPriceKind" runat="server" AutoPostBack="true" OnSelectedIndexChanged="PriceKindChange"
                                                        CssClass="DropDownShort">
                                                        <asp:ListItem Text="<%$ Resources:Language,Netto %>" Value="0"></asp:ListItem>
                                                        <asp:ListItem Text="<%$ Resources:Language,Brutto %>" Value="1" Selected="True"></asp:ListItem>
                                                    </asp:DropDownList>
                                                </span></span>
                            </div>
                            <div class="vSeparate">
                                <span class="peBoxLeft">
                                    <asp:Label ID="lSpecialOfferPrice" runat="server" Text="<%$ Resources:Language,SpecialOfferPriceBrutto %>"></asp:Label>:
                                </span><span class="peBoxRight"><span class="peInnerBoxRight">
                                    <asp:TextBox ID="tbSpecialOfferPrice" CssClass="TextInputShort" runat="server" OnTextChanged="PriceKindChange"
                                        AutoPostBack="true"></asp:TextBox>
                                </span><span class="peInnerBoxLeft">
                                    <asp:Label ID="lSpecialOfferPriceKind" runat="server" Text="<%$Resources:Language,SpecialOfferPriceNetto %>"></asp:Label>:</span><span
                                        class="peInnerBoxRight">
                                        <asp:TextBox ID="tbSpecialOfferPrice2" CssClass="TextInputShort" runat="server" Enabled="false"></asp:TextBox>
                                    </span><span class="peInnerBoxLeft">
                                        <%=Resources.Language.VatRate %>: </span><span class="peInnerBoxRight">
                                            <asp:DropDownList ID="ddlVatRate" runat="server" DataTextField="VatRateLabel" DataValueField="VatRateID"
                                                CssClass="DropDownShort" OnSelectedIndexChanged="PriceKindChange" AutoPostBack="true">
                                            </asp:DropDownList>
                                        </span></span>
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%=Resources.Language.PromotionPrioryty %>:</span><span class="peBoxRight"><asp:TextBox
                                ID="tbPromotionPrioryty" CssClass="TextInputShort" runat="server"></asp:TextBox>
                                (<%= Resources.Language.ImportanceInfo %>)</span>
                    </div>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%=Resources.Language.Visible %>: </span><span class="peBoxRight"><span class="peInnerBoxRight">
                                <asp:CheckBox ID="cbVisible" runat="server" />
                            </span><span class="peInnerBoxLeft">
                                <%= Resources.Language.OnDemand %>: </span><span class="peInnerBoxRight">
                                    <asp:CheckBox ID="chbOnDemand" runat="server" />
                                </span><span class="peInnerBoxLeft">
                                    <%=Resources.Language.Promoted %>: </span><span class="peInnerBoxRight">
                                        <asp:CheckBox ID="cbPromoted" runat="server" />
                                    </span></span>
                    </div>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%=Resources.Language.Category %>: </span><span class="peBoxRight">
                                <asp:DropDownList ID="ddlCategory" runat="server" EnableViewState="False" DataTextField="Name"
                                    DataValueField="IDcategory" OnSelectedIndexChanged="ddlCategory_SelectedIndexChanged"
                                    AutoPostBack="True" CssClass="DropDownWide">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvCategory" runat="server" ControlToValidate="ddlCategory"
                                    ErrorMessage="*" EnableClientScript="false"></asp:RequiredFieldValidator>
                            </span>
                    </div>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%=Resources.Language.Producer %>: </span><span class="peBoxRight">
                                <asp:DropDownList ID="ddlProducer" runat="server" CssClass="DropDown" DataTextField="Name"
                                    DataValueField="IDProducer">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvProducer" runat="server" ControlToValidate="ddlProducer"
                                    ErrorMessage="*" EnableClientScript="false"></asp:RequiredFieldValidator>
                            </span>
                    </div>
                    <div class="vSeparate">
                        <span class="peBoxLeft">Bundle: </span><span class="peBoxRight">
                            <input id="cbIsBundle" type="checkbox" runat="server" />
                        </span>
                    </div>
                    <div id="dAddProductToBundle" class="vSeparate" runat="server" style="display: none;">
                        <asp:UpdatePanel ID="upBundle" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                            <ContentTemplate>
                                <span class="peBoxLeft">
                                    <%=Resources.Language.AddProduct %>: </span><span class="peBoxRight">
                                        <div class="vSeparate">
                                            <ctrl:ctrlProductChoose ID="cpcChooseBundle" runat="server" AutoPostBack="false"
                                                ShowBundle="true" BindControl='<%# cbIsBundle.Checked %>' DisplayLabels="false" />
                                        </div>
                                        <div class="vSeparate">
                                            <asp:Button ID="btnAddBundle" runat="server" Text="<%$Resources:Language,Add %>"
                                                OnClick="btnAddBundle_Click" CausesValidation="false" />
                                        </div>
                                        <div class="vSeparate">
                                            <div class="LimitedMaxWidth">
                                                <asp:GridView ID="gvBundleProducts" runat="server" CssClass="cmsTables" AutoGenerateColumns="false"
                                                    OnRowDeleting="gvBundleProducts_RowDeleting">
                                                    <Columns>
                                                        <asp:BoundField DataField="IDproduct" HeaderText="ID" />
                                                        <asp:BoundField DataField="Name" HeaderText="<%$Resources:Language,Name %>" />
                                                        <asp:CommandField ShowDeleteButton="true" DeleteText="<%$Resources:Language,DeleteLower %>" />
                                                    </Columns>
                                                </asp:GridView>
                                            </div>
                                        </div>
                                    </span>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                    <div class="vSeparate">
                        <asp:UpdatePanel ID="upRelatedProduct" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                            <ContentTemplate>
                                <span class="peBoxLeft">
                                    <%=Resources.Language.RelatedProduct %>: </span><span class="peBoxRight">
                                        <div class="vSeparate">
                                            <ctrl:ctrlProductChoose ID="cpcChooseRelatedProduct" runat="server" AutoPostBack="false"
                                                DisplayLabels="false" BindControl="true" />
                                        </div>
                                        <div class="vSeparate">
                                            <asp:Button ID="btnAddRelatedProduct" runat="server" Text="<%$Resources:Language,Add %>"
                                                OnClick="btnAddRelatedProduct_Click" CausesValidation="false" />
                                        </div>
                                        <% if (gvRelatedProduct.Rows.Count > 0)
                                           { %>
                                        <div class="vSeparate LimitedMaxWidth">
                                            <asp:GridView ID="gvRelatedProduct" runat="server" CssClass="cmsTables" AutoGenerateColumns="false"
                                                OnRowDeleting="gvRelatedProduct_RowDeleting">
                                                <Columns>
                                                    <asp:BoundField DataField="IDproduct" HeaderText="ID" />
                                                    <asp:BoundField DataField="Name" HeaderText="<%$Resources:Language,Name %>" />
                                                    <asp:CommandField ShowDeleteButton="true" DeleteText="<%$Resources:Language,DeleteLower %>" />
                                                </Columns>
                                            </asp:GridView>
                                        </div>
                                        <%} %>
                                    </span>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%=Resources.Language.ShortDescription %>: </span><span class="peBoxRight">
                                <cc2:HtmlEditor ID="heShortDescription" runat="server" OutputXHTML="false" ConvertDeprecatedSyntax="false"
                                    Width="600px" />
                            </span>
                    </div>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%=Resources.Language.Description %>: </span><span class="peBoxRight">
                                <cc2:HtmlEditor ID="heDescription" runat="server" EnableViewState="true" OutputXHTML="false"
                                    ConvertDeprecatedSyntax="false" Width="600px" />
                            </span>
                    </div>
                    <asp:UpdatePanel ID="upProperty" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <% if (dlProperty.Items.Count > 0)
                               { %>
                            <div class="vSeparate">
                                <span class="peBoxLeft">
                                    <%=Resources.Language.ProductDetails %>: </span><span class="peBoxRight">
                                        <asp:DataList ID="dlProperty" runat="server" RepeatColumns="2" RepeatDirection="Horizontal"
                                            DataKeyField="Id" OnItemDataBound="dlPropertyItemDataBound" ItemStyle-Width="350px"
                                            ItemStyle-CssClass="pBox" RepeatLayout="Flow">
                                            <ItemTemplate>
                                                <asp:Label ID="lblName" runat="server"><%#Eval("Name") %>:</asp:Label><br />
                                                <asp:DropDownList ID="ddlValues" runat="server" CssClass="DropDown" DataSource='<%#((ShopModel.ProductPropertyDetail)Container.DataItem).TypeOfProperty ==ShopModel.PropertyType.Dictionary?((ShopModel.ProductPropertyDetail)Container.DataItem).ValuesList:null %>'
                                                    DataTextField="Name" DataValueField="Value" Visible='<%#((ShopModel.ProductPropertyDetail)Container.DataItem).TypeOfProperty ==ShopModel.PropertyType.Dictionary?true:false %>'>
                                                </asp:DropDownList>
                                                <asp:TextBox ID="tbNewValue" runat="server" CssClass="TextInput" Visible='<%#((ShopModel.ProductPropertyDetail)Container.DataItem).TypeOfProperty ==ShopModel.PropertyType.Dictionary?true:false %>'></asp:TextBox>
                                                <asp:TextBox ID="tbValue" runat="server" CssClass="TextInput" Text='<%#((ShopModel.ProductPropertyDetail)Container.DataItem).TypeOfProperty ==ShopModel.PropertyType.Text?((ShopModel.ProductPropertyDetail)Container.DataItem).Value:((ShopModel.ProductPropertyDetail)Container.DataItem).TypeOfProperty ==ShopModel.PropertyType.Numeric? ((ShopModel.ProductPropertyDetail)Container.DataItem).NumericValue.ToString():""  %>'
                                                    Visible='<%#(((ShopModel.ProductPropertyDetail)Container.DataItem).TypeOfProperty==ShopModel.PropertyType.Text || ((ShopModel.ProductPropertyDetail)Container.DataItem).TypeOfProperty==ShopModel.PropertyType.Numeric)?true:false %>'></asp:TextBox>
                                                <asp:CompareValidator ID="cvValue" runat="server" ControlToValidate="tbValue" Display="Dynamic"
                                                    Text="*" Operator="DataTypeCheck" Type="Double" Visible="<%#((ShopModel.ProductPropertyDetail)Container.DataItem).TypeOfProperty==ShopModel.PropertyType.Numeric?true:false %>"></asp:CompareValidator>
                                                <div id="Div1" runat="server" visible='<%#((ShopModel.ProductPropertyDetail)Container.DataItem).TypeOfProperty ==ShopModel.PropertyType.MultiDictionary?true:false %>'>
                                                    <asp:CheckBoxList ID="cblValues" runat="server" DataSource='<%#((ShopModel.ProductPropertyDetail)Container.DataItem).TypeOfProperty ==ShopModel.PropertyType.MultiDictionary?((ShopModel.ProductPropertyDetail)Container.DataItem).ValuesList:null %>'
                                                        DataTextField="Name" DataValueField="Value" Visible='<%#((ShopModel.ProductPropertyDetail)Container.DataItem).TypeOfProperty ==ShopModel.PropertyType.MultiDictionary?true:false %>'>
                                                    </asp:CheckBoxList>
                                                </div>
                                            </ItemTemplate>
                                            <ItemStyle VerticalAlign="Top" />
                                        </asp:DataList>
                                    </span>
                            </div>
                            <%} %>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ddlCategory" />
                        </Triggers>
                    </asp:UpdatePanel>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%=Resources.Language.Picture%>: </span><span class="peBoxRight">
                                <asp:FileUpload ID="fuMainPicture" runat="server" />
                                <asp:CheckBox ID="chbMainPicture" runat="server" Text="<%$Resources:Language,MainForChoosenProduct %>"
                                    CssClass="hSeparate" />
                            </span>
                    </div>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%=Resources.Language.Thumbnail%>: </span><span class="peBoxRight">
                                <asp:FileUpload ID="fuMiniaturePicture" runat="server" Enabled="False" />
                                <asp:CheckBox ID="chbCreateMiniature" runat="server" Text="<%$Resources:Language,CreateThumbFromMain %>"
                                    Checked="True" CssClass="hSeparate" />
                            </span>
                    </div>
                    <div class="vSeparate">
                        <span class="peBoxLeft"></span><span class="peBoxRight">
                            <asp:Button ID="btnAddPicture" runat="server" Text="<%$Resources:Language,AddPicture %>"
                                OnCommand="Picture_Command" CommandName="Add" />
                        </span>
                    </div>
                    <%if (rptPicture.Items.Count > 0)
                      { %>
                    <div class="vSeparate">
                        <asp:UpdatePanel ID="upPictures" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                            <ContentTemplate>
                                <span class="peBoxLeft">
                                    <%=Resources.Language.CurrentProductPictures%>: </span><span class="peBoxRight">
                                        <div style="overflow: auto;">
                                            <asp:Repeater ID="rptPicture" runat="server">
                                                <ItemTemplate>
                                                    <div style="float: left;">
                                                        <table style="text-align: center;">
                                                            <tbody>
                                                                <tr>
                                                                    <td>
                                                                        <asp:Image ID="Image1" runat="server" ImageUrl='<%# ((ShopModel.PictureInfo)Container.DataItem).Miniature.VirtualPath %>' />
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <asp:LinkButton ID="LinkButton1" runat="server" Text="<%$Resources:Language,DeleteUpper %>"
                                                                            CommandName="Remove" CommandArgument=' 
																																																				<%# ((ShopModel.PictureInfo)Container.DataItem).PictureId.ToString() %>'
                                                                            OnCommand="Picture_Command"></asp:LinkButton>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <asp:LinkButton ID="lnkMain" runat="server" Text="<%$Resources:Language,SetAsMain %>"
                                                                            CommandName="SetAsMain" CommandArgument='<%# ((ShopModel.PictureInfo)Container.DataItem).PictureId.ToString() %>'
                                                                            OnCommand="Picture_Command" Visible='<%# !(bool)Eval("IsMain") %>'></asp:LinkButton>
                                                                    </td>
                                                                </tr>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:Repeater>
                                        </div>
                                    </span>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                    <%} %>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%=Resources.Language.AddDocument%>: </span><span class="peBoxRight"><span>
                                <asp:FileUpload ID="fuDocument" runat="server" />
                            </span><span class="hSeparate">
                                <asp:Button ID="btnAddDocument" runat="server" Text='<%$Resources:Language,AddDocument %>'
                                    CommandName="Add" OnCommand="Document_Command" />
                            </span></span>
                    </div>
                    <% if (rptDocuments.Items.Count > 0)
                       { %>
                    <div class="vSeparate">
                        <asp:UpdatePanel ID="upDocuments" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                            <ContentTemplate>
                                <span class="peBoxLeft">
                                    <%=Resources.Language.Documents%>: </span><span class="peBoxRight">
                                        <asp:Repeater ID="rptDocuments" runat="server">
                                            <ItemTemplate>
                                                <div>
                                                    <span><a href='<%# "../" + Eval("Url") %>' target="_blank">
                                                        <%# Eval("FileName") %></a> </span><span>
                                                            <asp:LinkButton ID="lbDeleteDocument" runat="server" Text="<%$Resources:Language,DeleteUpper %>"
                                                                CommandName="Delete" CommandArgument='<%# Eval("DocumentID")%>' OnCommand="Document_Command"></asp:LinkButton>
                                                        </span>
                                                </div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </span>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                    <%} %>
                    <div class="vSeparate">
                        <span class="peBoxLeft">
                            <%= Resources.Language.AddVideo %>: </span><span class="peBoxRight"><span>
                                <asp:FileUpload ID="fuVideo" runat="server" />
                            </span><span class="hSeparate">
                                <%=Resources.Language.Label%>:
                                <asp:TextBox ID="tbVideoLabel" runat="server" ValidationGroup="VideoLabelRequired"
                                    EnableViewState="false"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvVideoLabel" runat="server" ErrorMessage="*" ControlToValidate="tbVideoLabel"
                                    ValidationGroup="VideoLabelRequired" Display="Dynamic"></asp:RequiredFieldValidator>
                            </span><span class="hSeparate">
                                <asp:Button ID="btnAddVideo" runat="server" Text="<%$Resources:Language,AddVideo %>"
                                    OnCommand="Video_Command" CommandName="Add" ValidationGroup="VideoLabelRequired" />
                            </span></span>
                    </div>
                    <%  if (rptVideos.Items.Count > 0)
                        {%>
                    <div class="vSeparate">
                        <asp:UpdatePanel ID="upVideos" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                            <ContentTemplate>
                                <span class="peBoxLeft">
                                    <%=Resources.Language.CurrentProductVideos%>: </span><span class="peBoxRight">
                                        <asp:Repeater ID="rptVideos" runat="server">
                                            <ItemTemplate>
                                                <div>
                                                    <span><a 
                                                    
                                                    <%#(int)Eval("VideoID") > 0 ? "href=\"#\" onclick=\"window.open('" + ShopModel.Settings.ShopUrl +  Eval("VideoID").ToString()+","+Resources.Language.UrlWatchVideo.ToLower()+".aspx', '','width=495,height=335,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no');\"" : ""%>>                                                                                                         
                                                        <%# Eval("Label") %></a> </span><span>
                                                            <asp:LinkButton ID="lbDeleteVideo" runat="server" Text="<%$Resources:Language,DeleteUpper %>"
                                                                CommandName="Delete" CommandArgument='<%# Eval("VideoID") %>' OnCommand="Video_Command"></asp:LinkButton>
                                                        </span>
                                                </div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </span>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                    <%} %>
                    <div class="Controls">
                        <span class="peBoxLeft"></span><span class="peBoxRight">
                            <asp:Button ID="btnSaveChangesBottom" runat="server" Text="<%$Resources:Language,SaveChanges %>"
                                OnClick="btnSaveProduct_Click" OnClientClick="ScrollTop();" />
                            <asp:Button ID="btnNewProductBottom" runat="server" Text="<%$Resources:Language,CreateNew %>"
                                OnClick="btnNewProduct_Click" CausesValidation="false" OnClientClick="ScrollTop();" />
                            <asp:Button ID="btnCancelChangesBottom" runat="server" Text="<%$Resources:Language,Cancel %>"
                                OnClick="btnCancelChanges_Click" CausesValidation="false" OnClientClick="ScrollTop();" />
                            <asp:Button ID="btnDeleteProductBottom" runat="server" Text="<%$Resources:Language,DeleteProduct %>"
                                OnClick="btnDeleteProduct_Click" CausesValidation="false" />
                        </span>
                    </div>
                </div>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnAddVideo" />
            <asp:PostBackTrigger ControlID="btnAddPicture" />
            <asp:PostBackTrigger ControlID="btnAddDocument" />
            <asp:AsyncPostBackTrigger ControlID="ctrlProductChoose" />
            <asp:AsyncPostBackTrigger ControlID="ctrlSearchProduct" />
            <asp:AsyncPostBackTrigger ControlID="btnNewProductTop" />
            <asp:AsyncPostBackTrigger ControlID="btnNewProductBottom" />
            <asp:AsyncPostBackTrigger ControlID="btnSaveChangesTop" />
            <asp:AsyncPostBackTrigger ControlID="btnSaveChangesBottom" />
            <asp:AsyncPostBackTrigger ControlID="btnDeleteProductTop" />
            <asp:AsyncPostBackTrigger ControlID="btnDeleteProductBottom" />
            <asp:AsyncPostBackTrigger ControlID="btnCancelChangesTop" />
            <asp:AsyncPostBackTrigger ControlID="btnCancelChangesBottom" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
